﻿@model PerformanceAssessment.Models.SkillAssessment
@{
    ViewBag.Title = "Employee Evaluation";
}

@section Head
{
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<style type="text/css">
    .employee_info
    {
        width: 1000px;
        margin: 0;
        padding: 0;
    }
    .item_container
    {
        width: 1000px;
        height: 250px;
        margin: 0;
        padding: 0;
    }
    
    .skill_desc
    {
        width: 300px;
    }
    
    .skill_desc p
    {
        margin: 0px 10px 0px 10px;
        text-align:justify;
    }
    
    .score_container
    {
        width: 100px;
        height: 125px;
        text-align: center;
        vertical-align: middle;
    }
    
    .comments_container
    {
        width: 600px;
        height: 125px;
        text-align: center;
        vertical-align: middle;
    }
    
    .score_container p
    {
        display: block;
        font-style: italic;
        margin-bottom: 5px;
        margin-top: 0px;
    }
    
    .score_container input
    {
        margin: 0px auto 0px auto;
        width: 80px;
    }
    
    .comments_container textarea
    {
        font: inherit;
        margin-left: auto;
        margin-right: auto;
        width: 580px;
        height: 100px;
    }
    
    .btn_submit
    {
        font: inherit;
        width: 100px;
        text-align: center;
    }
</style>
}
@using PerformanceAssessment.Models;

<h2>Skills Assessment</h2>
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)

    <fieldset style="border-width:0px;padding:0; margin:0;">
    <table class="employee_info">
    <tr>
        <td colspan="2">
            Name: @string.Format("{0} {1}", ViewBag.assessment.Employee.FirstName, ViewBag.assessment.Employee.FirstLastName)
        </td>
        <td colspan="2">
            Manager: @string.Format("{0} {1}", ViewBag.assessment.Manager.FirstName, ViewBag.assessment.Manager.LastName)
        </td>
    </tr>
    <tr>
        <td colspan="2">
            Department: @ViewBag.assessment.Employee.Team.Name
        </td>
        <td>
            Date Hired:
            @if (ViewBag.assessment.Employee.StartDate != null) 
            {
                @ViewBag.assessment.Employee.StartDate.ToShortDateString() 
            }
        </td>
        <td>
            Period: @ViewBag.assessment.FromDate.ToShortDateString() to: @ViewBag.assessment.ToDate.ToShortDateString()
        </td>
    </tr>
</table>

        @Html.HiddenFor(model => model.IdAssessment)
        @Html.HiddenFor(model => model.IdSkill)
        @Html.Hidden("order", (object)ViewBag.order)
        <table class="item_container">
            <tr>
                <th>
                    Skill
                </th>
                <th>
                    Score
                </th>
                <th>
                    Comments/Examples
                </th>
            </tr>
            <tr>
                <td rowspan="2" class="skill_desc">
                    <p style="text-transform: uppercase; text-align: center; font-weight: bold">@Model.Skill.Name</p>
                    <p>@Model.Skill.Description</p>
                </td>
                <td class="score_container">
                    <p>
                        (A)</p>
                    @if (ViewBag.assessment.EditionAllowed(ViewBag.userType, UserType.Employee))
                    {
                            @Html.TextBoxFor(model => model.EmployeeScore)
                    }
                    else
                    {
                            @Html.Hidden("EmployeeScore")
                            @Html.TextBoxFor(model => model.EmployeeScore, new { disabled = "true" })
                    }
                </td>
                <td class="comments_container">
                    @if (ViewBag.assessment.EditionAllowed(ViewBag.userType, UserType.Employee))
                    {
                        @Html.TextAreaFor(model => model.EmployeeComments)
                    }
                    else
                    {
                        @Html.Hidden("EmployeeComments")
                        @Html.TextAreaFor(model => model.EmployeeComments, new { disabled = "true" })
                    }
                </td>
            </tr>
            <tr>
                <td class="score_container">
                    <p>
                        (M)</p>
                        @if (ViewBag.assessment.EditionAllowed(ViewBag.userType, UserType.Manager))
                        {
                            @Html.TextBoxFor(model => model.ManagerScore)
                        }
                        else
                        {
                            @Html.Hidden("ManagerScore")
                            @Html.TextBoxFor(model => model.ManagerScore, new { disabled = "true" })
                        }
                </td>
                <td class="comments_container">
                    @if (ViewBag.assessment.EditionAllowed(ViewBag.userType, UserType.Manager))
                    {
                        @Html.TextAreaFor(model => model.ManagerComments)
                    }
                    else
                    {
                        @Html.Hidden("ManagerComments")
                        @Html.TextAreaFor(model => model.ManagerComments, new { disabled = "true" })
                    }
                </td>
            </tr>
        </table>
        <table class="employee_info">
            <tr>
                <td>
                    <strong>(A)</strong> Auto evaluation <strong>(M)</strong> Manager
                </td>
                <td colspan="3">
                    Scores: <strong>0</strong> = N/A <strong>1</strong> = Does Not Meet Job Expectations
                    <strong>2</strong> = Partially Meets Job Expectations <strong>3</strong> = Meets
                    Job Expectations <strong>4</strong> = Exceeds Job Expectations
                </td>
            </tr>
        </table>
    </fieldset>
    @Html.ValidationMessageFor(model => model.EmployeeScore)
    @Html.ValidationMessageFor(model => model.ManagerScore)
    @Html.ValidationMessageFor(model => model.EmployeeComments)
    <div class="employee_info" >
        <input class="btn_submit" type="submit" name="btnBack" value="< Back" />&nbsp;
        <input class="btn_submit" type="submit" name="btnNext" value="Next >" />
    </div>
}
<div>
    @Html.ActionLink("Back to Assessment", "Details", "Assessments", new { assessmentId = ViewBag.assessment.ID }, null)
</div>
